package com.example.wei.mvp.ui.dialog;

import android.app.ProgressDialog;
import android.content.Context;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.wei.mvp.R;


/**
 * @author 
 */
public class LoadingProgressDialog extends ProgressDialog {

	private AnimationDrawable mAnimation;
	private Context mContext;
	private ImageView mImageView;
	private String mLoadingTitle;
	private TextView mLoadingTv;


	public LoadingProgressDialog(Context context) {
		super(context);
	}

	public LoadingProgressDialog(Context context, int theme) {
		super(context, theme);
	}

	public LoadingProgressDialog(Context context, String content) {
		super(context, R.style.succinctProgressDialog);
		this.mContext = context;
		this.mLoadingTitle = content;
		setCanceledOnTouchOutside(true);
	}


	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		initView();
		initData();

	}

	private void initData() {

//		mImageView.setBackgroundResource(mResid);
//		mAnimation = (AnimationDrawable) mImageView.getBackground();
//		mImageView.post(new Runnable() {
//			@Override
//			public void run() {
//				mAnimation.start();
//			}
//		});
		mLoadingTv.setText(mLoadingTitle);

	}

	public void setContent(String str) {
		mLoadingTv.setText(str);
	}

	private void initView() {
		setContentView(R.layout.progress_dialog);
		mLoadingTv = (TextView) findViewById(R.id.loadingTv);
		//mImageView = (ImageView) findViewById(R.id.loadingIv);
	}
}
